home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1990 / Aug 90 / MacApp.Tech$ 8⁄31⁄90 / 1823-Re Multiple Inherita-Aug90 < prev    next >
Encoding:
Text File  |  1991-03-06  |  1.6 KB  |  35 lines  |  [TEXT/GEOL]

  1. Item    2371253                         25-Aug-90        14:46PDT
  2.  
  3. From:   D2605                           Xanadu Operating,Marc Stiegler,PRT
  4.  
  5. To:     POWERUP.ENG                     Power Up Software,PRT
  6.  
  7. cc:     MACAPP.TECH$                    MacApp Technical
  8.  
  9. Sub:    Re: Multiple Inheritance Ques
  10.  
  11. James,
  12.     A simple solution to this problem is to have a the class you referred to as
  13. TCard simply maintain a front and back, rather than inherit from two classes.
  14. You don't need multiple inheritance for this example (or almost anything else).
  15.     As a possible solution to the 'security' problem, the part of the
  16. application that creates the opponents card representations would wrap the
  17. opponent's cards (or any card which has the front hidden) with an object that
  18. will return the back, but when asked for the front would inform the opponent of
  19. an attempt to cheat.  This TBackOnlyCard class would be derived from the TCard
  20. class and would point to a TCard.  Similarly, a THiddenCard class would point
  21. to a TCard, but not allow access to the back OR front (for those cards still in
  22. the deck).  All of these classes would be derived from a common abstract
  23. superclass.
  24.     This 'wrapping' of an object (or multiple objects) is a very simple way to
  25. avoid multiple inheritance in almost any situation.  It does alter some
  26. protocol in some situations because a client of the class will need to ask for
  27. a particular aspect of the object before getting the details.  In this
  28. particular case, protocol change is not necessary.
  29.  
  30. Singly Inheritingly Yours,
  31.  
  32. --Hugh Hoover
  33.   Xanadu Operating Company
  34.  
  35.